package com.wwj.mapper;

import com.github.pagehelper.Page;
import com.wwj.annotation.AutoFill;
import com.wwj.annotation.enumeration.OperationType;
import com.wwj.pojo.dto.SetmealPageQueryDTO;
import com.wwj.pojo.entity.Setmeal;
import com.wwj.pojo.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

@Mapper
public interface SetmealMapper {

    /**
     * 根据分类id查询套餐的数量
     */
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);

    @Select("select * from setmeal where id = #{id}")
    Setmeal selectById(Long id);

    //分页查询
    Page<SetmealVO> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO);


    @AutoFill(value = OperationType.UPDATE)
    //更新套餐
    void update(Setmeal setmeal);


    //插入套餐
    @AutoFill(value = OperationType.INSERT)
    void insertSetmeal(Setmeal setmeal);


    //删除套餐
    void deleteById(Long id);


}
